// src/Router.jsx
//BrowserRouer 使用HTML5的history API创建一个React路由器，负责管理URl历史堆栈
//Routes：包含多个 Route，每个 Route 定义了一个路径和对应的组件。
//Route：定义路径与组件的映射关系。

// import { useState } from 'react';
import { BrowserRouter as Router, Route, Routes } from 'react-router-dom';
// import Home from '../views/home/Home';
// import UserLogin from '../views/UserLogin';
// import UserRegister from '../views/UserRegister';
import AdminLogin from '../views/Login/AdminLogin';
import AdminRegister from '../views/register/AdminRegister';
import Admin from '../views/admin/Admin'
import UserManagement from '../views/admin/admin-children/userManagement/content';
import ProductManagement1 from '../views/admin/admin-children/productManagement/content';
import ProductManagement2 from '../views/admin/admin-children/productManagement/content';
import ProductCategory from '../views/admin/admin-children/productCategory/content';
import OrderManagement from '../views/admin/admin-children/orderManagement/content';
import AdManagement from '../views/admin/admin-children/admanagement/content';
import AddAd from '../views/admin/admin-children/admanagement/header';

//建立大的Router负责并且
const AppRouter = () => {
    //  const [collapsed, setCollapsed] = useState(false);
return (<Router>
    <Routes>
        {/* <Route path="/" element={<Home />} /> */}
        {/* <Route path="/user/login" element={<UserLogin />} /> */}
        {/* <Route path="/user/register" element={<UserRegister />} /> */}
        <Route path="/admin" element={<Admin />} />
        <Route path="/admin/register" element={<AdminRegister />} />
        <Route path="/" element={<AdminLogin />} />
        <Route path="/admin/usermanagement" element={<UserManagement />} />
        <Route path='/admin/productmanagement1' element={<ProductManagement1 />} />
        <Route exact path='/admin/productmanagement2' element={<ProductManagement2 />} />
        <Route path="/admin/productcategory" element={<ProductCategory />} />
        <Route path="/admin/ordermanagement" element={<OrderManagement />} />
        <Route exact path="/admin/admanagement" element={<AdManagement />} />
        <Route exact path="/ad-management/add" element={<AddAd />} /> 
    </Routes>
</Router>)
   
};

export default AppRouter;
